package com.tcp2.msg.rpc;

import com.yaxon.vndp.dms.Message;

/**
 * Author: 程行荣
 * Time: 2013-10-30 15:10
 * Copyright (C) 2013 Xiamen Yaxon Networks CO.,LTD.
 */

/**
 * 应答消息基类
 */
public abstract class BaseRes implements Message {
    /* 通用应答码定义 */
    public static final byte RC_OK = 0x00; //成功
    public static final byte RC_FAIL = 0x01; //失败
    public static final byte RC_BAD_REQUEST = 0x02; //失败：错误请求
    public static final byte RC_TIMEOUT = 0x03; //失败：超时异常
    public static final byte RC_FORBIDDEN = 0x04; //失败：请求被禁止
    public static final byte RC_INTERNAL_SERVER_ERROR = 0x05; //失败：内部服务器异常

    protected byte rc = 0; //应答码: 0:成功
    protected String errMsg; //错误信息

    protected BaseRes() {
    }

    protected BaseRes(byte rc, String errMsg) {
        this.rc = rc;
        this.errMsg = errMsg;
    }

    public byte getRc() {
        return rc;
    }

    public void setRc(byte rc) {
        this.rc = rc;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    @Override
    public String toString() {
        return "rc=" + rc + ", errMsg='" + errMsg + "'";
    }
}
